<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div>
    <button class="btn">按钮1</button>
    <button class="btn">按钮2</button>
    <button class="btn">按钮3</button>
    <button class="btn">按钮4</button>
    <button class="btn">按钮5</button>
  </div>
  <hr>
  <button id="btn">按钮</button>
  <script src="../libs/jquery-1.12.4.js"></script>
  <script>
    /* 
      1 triggerHandler不会触发默认行为，也不会产生冒泡
      2 triggerHandler只会触发集合中第一个元素的事件
      3 triggerHandler返回值是事件处理函数的返回值，而非链式调用的对应jquery对象
    
     */
    $(function () {
      $('.btn').on('click', function () {
        console.log('点击了按钮' + ($(this).index() + 1))
        return 1
      })

      $('#btn').on('click', function () {
        // console.log($('.btn').trigger('click'))
        console.log($('.btn').triggerHandler('click'))
      })

    })
  
  </script>
</body>
</html>